package com.kaifamiao.month03.day0323;

import java.util.Scanner;

public class Egg {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        System.out.println("请输入您的消费金额：");
        int money = in.nextInt();
        System.out.println("占便宜版本的鸡蛋个数为：" + favorable(money));
        System.out.println("不占便宜版本的鸡蛋个数为：" + good(money));
    }
    public static int favorable(int money){
        int eggCount = 0;
        switch (money / 50){
            case 20:
                eggCount += 50;
            case 10:
                eggCount += 15;
            case 4:
                eggCount += 5;
            case 2:
                eggCount += 2;
            case 1:
                eggCount += 1;
                break;
        }
        return eggCount;
    }

    public static int good(int money){
        int eggCount = 0;
        switch (money / 50){
            case 20 -> eggCount += 50;
            case 10 -> eggCount += 15;
            case 4 -> eggCount += 5;
            case 2 -> eggCount += 2;
            case 1 -> eggCount += 1;
        }
        return eggCount;
    }
}
